import request from '@/utils/request'

export default {
  /**
   * 分页查询
   * @param data
   */
  init(data) {
    return request({
      url: `/tms-aggregation/tms-webManager/transportOrder/page`,
      method: 'post',
      data: data
    })
  },
  /**
   * 根据运单Id查询运单详情
   * @param transportOrderId
   * @returns {AxiosPromise}
   */
  findTransportOrderDetailsById(transportOrderId) {
    return request({
      url: `/tms-work/transport-order/findTransportOrderDetailsById/${transportOrderId}`,
      method: 'get'
    })
  },
  /**
   * 根据订单id查询详情
   * @param orderId
   * @returns {AxiosPromise}
   */
  findTransportOrderDetailsByOrderById(orderId) {
    return request({
      url: `/tms-work/transport-order/findTransportOrderDetailsByOrderById/${orderId}`,
      method: 'get'
    })
  },
  /**
   * 获取所有线路信息
   * @returns {AxiosPromise}
   */
  queryAllTransportLine() {
    return request({
      url: `/base/goods/pd-transport-line/queryAll`,
      method: 'get'
    })
  },
  /**
   * 根据机构Id查询对应的快递员信息
   * @param agencyId
   * @returns {AxiosPromise}
   */
  findCourier(agencyId) {
    return request({
      url: `/base/base/pd-courier-scop/findGlobalUserByCoreOrgId/${agencyId}`,
      method: 'get'
    })
  },
  /**
   * 批量添加取派件任务
   * @param data
   * @returns {AxiosPromise}
   */
  addTaskPickupDispatch(data) {
    return request({
      url: `/tms-work/task-pickup-dispatch/addTaskPickupDispatch`,
      method: 'post',
      data: data
    })
  },
  /**
   * 根据线路获取对应的车次数据
   * @param lineId 线路Id
   * @returns {AxiosPromise}
   */
  findTripsAllByLineId(lineId) {
    return request({
      url: `/base/goods/pd-transport-trips/findByLineID/${lineId}`,
      method: 'get'
    })
  },
  /**
   * 根据车次id查询出车辆,司机信息
   * @param id
   * @returns {AxiosPromise}
   */
  findTransportTripsById(id) {
    return request({
      url: `/base/goods/pd-transport-line/findTransportTripsById/${id}`,
      method: 'get'
    })
  },
  /**
   * 添加订单分离车辆司机车次关联表以及订单分类和线路的中间表
   * @param data
   * @returns {AxiosPromise}
   */
  orderClassifyTripsTruckDriverAdd(data) {
    return request({
      url: `/dispatch/dispatch/order-classify-attach/orderClassifyTripsTruckDriverAdd`,
      method: 'post',
      data: data
    })
  },
  /**
   * 添加运输任务
   * @param data
   * @returns {AxiosPromise}
   */
  addTaskTransport(data) {
    return request({
      url: `/tms-work/task-transport/save`,
      method: 'post',
      data: data
    })
  },
  /**
   * 司机作业单
   * @param data
   * @returns {AxiosPromise}
   */
  addDriverJob(data) {
    return request({
      url: `/tms-work/driver-job/save`,
      method: 'post',
      data: data
    })
  }
}
